﻿<UserControl x:Class="FlickrSample.View.Common.BackBar"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:XamlingCore_SL_Controls_Content="clr-namespace:XamlingCore.SL.Controls.Content;assembly=XamlingCore.SL.Controls" xmlns:Common="clr-namespace:FlickrSample.View.Common" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
	<UserControl.Resources>
		<Style x:Key="SlideTransitionTemplate" TargetType="XamlingCore_SL_Controls_Content:XTransitionContentControl">

			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="XamlingCore_SL_Controls_Content:XTransitionContentControl">
						<Grid>
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="ContentStates">
									<VisualStateGroup.Transitions>
										<VisualTransition GeneratedDuration="0:0:1">
											<VisualTransition.GeneratedEasingFunction>
												<CubicEase EasingMode="EaseInOut"/>
											</VisualTransition.GeneratedEasingFunction>
										</VisualTransition>
										<VisualTransition GeneratedDuration="0" To="BeforeTransition"/>
										<VisualTransition GeneratedDuration="0" To="BeforeTransitionReverse"/>
									</VisualStateGroup.Transitions>
									<VisualState x:Name="NoContent"/>
									<VisualState x:Name="Normal">
										<Storyboard>
											<DoubleAnimation Duration="0" To="-408" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="oldContentPresenter" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="oldContentPresenter" d:IsOptimized="True"/>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="oldContentPresenter">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="NormalReverse">
										<Storyboard>
											<DoubleAnimation Duration="0" To="408" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="oldContentPresenter" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="oldContentPresenter" d:IsOptimized="True"/>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="oldContentPresenter">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="BeforeTransitionReverse">
										<Storyboard>
											<DoubleAnimation Duration="0" To="-414" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="contentPresenter">
												<DiscreteObjectKeyFrame KeyTime="0">
													<DiscreteObjectKeyFrame.Value>
														<Visibility>Collapsed</Visibility>
													</DiscreteObjectKeyFrame.Value>
												</DiscreteObjectKeyFrame>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="BeforeTransition">
										<Storyboard>
											<DoubleAnimation Duration="0" To="410" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
											<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter" d:IsOptimized="True"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="VisualStateGroup"/>
							</VisualStateManager.VisualStateGroups>
							<ContentPresenter x:Name="oldContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" RenderTransformOrigin="0.5,0.5" CacheMode="BitmapCache">
								<ContentPresenter.RenderTransform>
									<CompositeTransform/>
								</ContentPresenter.RenderTransform>
								<ContentPresenter.Projection>
									<PlaneProjection CenterOfRotationX="0"/>
								</ContentPresenter.Projection>
							</ContentPresenter>
							<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" RenderTransformOrigin="0.5,0.5" CacheMode="BitmapCache">
								<ContentPresenter.RenderTransform>
									<CompositeTransform/>
								</ContentPresenter.RenderTransform>
								<ContentPresenter.Projection>
									<PlaneProjection CenterOfRotationX="1"/>
								</ContentPresenter.Projection>
							</ContentPresenter>

						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

	</UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Height="55" VerticalAlignment="Top" >
    	<Grid.Background>
    		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    			<GradientStop Color="#FF373737" Offset="0"/>
    			<GradientStop Color="#FF060606" Offset="1"/>
    			<GradientStop Color="#FF4B4B4B" Offset="0.513"/>
    			<GradientStop Color="#FE373737" Offset="0.522"/>
    		</LinearGradientBrush>
    	</Grid.Background>
        <!--<Button Content="{Binding ParentModel}" x:Name="button" Visibility="{Binding ParentModel.BackVisible}" Command="{Binding NavigateBackCommand}" Foreground="White" VerticalAlignment="Top" Height="31" FontFamily="Arial" FontWeight="Bold" HorizontalAlignment="Right" MaxWidth="60" Margin="0,5,0,0" Style="{StaticResource NiceButton}" Width="140" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
            <Button.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0"/>
                    <GradientStop Color="#FF999999" Offset="1"/>
                </LinearGradientBrush>
            </Button.Background>
            <Button.ContentTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding NavigationService.PreviousContentObject.Title}" TextWrapping="NoWrap" TextTrimming="WordEllipsis" Width="45" TextAlignment="Center"/>
                </DataTemplate>
            </Button.ContentTemplate>
        </Button>-->

        <XamlingCore_SL_Controls_Content:XTransitionContentControl x:Name="TransControl"
								ReverseTransition="{Binding NavigationService.IsReverseNavigation}"  
								Content="{Binding NavigationService.CurrentContentObject}" 
								TransitionsEnabled="{Binding TransitionsEnabled}"
								VerticalAlignment="Stretch" 
								HorizontalAlignment="Stretch" Style="{StaticResource SlideTransitionTemplate}"																				  
																				   >
            <ContentControl.ContentTemplate>
                <DataTemplate>
                    <Common:BackBarView/>
                </DataTemplate>
            </ContentControl.ContentTemplate>
        </XamlingCore_SL_Controls_Content:XTransitionContentControl>
        
      

    </Grid>
</UserControl>
